﻿/*
 * Copyright (c) 2015-2016 Constantijn Evenhuis (blueprints@const.nl)
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
using Blueprints.Editing;
using Blueprints.Editor.Commands;
using System.Collections.Generic;

namespace Blueprints.Editor
{
    /// <summary>
    /// Creates views for edit nodes.
    /// </summary>
    /// <typeparam name="ViewType">The type of view an implementation of this interface creates.</typeparam>
    public interface IViewFactory<ViewType>
    {
        /// <summary>
        /// Creates a view for an object node.
        /// </summary>
        /// <param name="node">The object node.</param>
        /// <param name="commands">The commands available for the view.</param>
        /// <param name="properties">The properties of the object.</param>
        /// <returns>The created view.</returns>
        ViewType CreateObjectView(EditNode node, IEditorCommands commands, IReadOnlyList<PropertyView<ViewType>> properties);

        /// <summary>
        /// Creates a view for a collection node.
        /// </summary>
        /// <param name="node">The collection node.</param>
        /// <param name="commands">The commands available for the view.</param>
        /// <param name="elements">The elements in the collection.</param>
        /// <returns>The created view.</returns>
        ViewType CreateCollectionView(EditNode node, IEditorCommands commands, IReadOnlyList<NodeView<ViewType>> elements);

        /// <summary>
        /// Creates a view for a multiselect node.
        /// </summary>
        /// <param name="node">The multiselect node.</param>
        /// <param name="commands">The commands available for the view.</param>
        /// <returns>The created view.</returns>
        ViewType CreateMultiSelectView(EditNode node, IEditorCommands commands);

        /// <summary>
        /// Creates a view for a value node.
        /// </summary>
        /// <param name="node">The value node.</param>
        /// <param name="commands">The commands available for the view.</param>
        /// <returns>The created view.</returns>
        ViewType CreateValueView(EditNode node, IEditorCommands commands);

        /// <summary>
        /// Creates a view for a singleselect node.
        /// </summary>
        /// <param name="node">The singleselect node.</param>
        /// <param name="commands">The commands available for the view.</param>
        /// <returns>The created view.</returns>
        ViewType CreateSingleSelectView(EditNode node, IEditorCommands commands);

        /// <summary>
        /// Creates a view for a boolean node.
        /// </summary>
        /// <param name="node">The boolean node.</param>
        /// <param name="commands">The commands available for the view.</param>
        /// <returns>The created view.</returns>
        ViewType CreateBooleanView(EditNode node, IEditorCommands commands);

        /// <summary>
        /// Creates a view for a link node.
        /// </summary>
        /// <param name="node">The link node.</param>
        /// <param name="commands">The commands available for the view.</param>
        /// <returns>The created view.</returns>
        ViewType CreateLinkView(EditNode node, IEditorCommands commands);

        /// <summary>
        /// Creates a view for a node of which the type could not be determined.
        /// </summary>
        /// <param name="node">The unknown node.</param>
        /// <param name="commands">The commands available for the view.</param>
        /// <returns>The created view.</returns>
        ViewType CreateUnknownView(EditNode node, IEditorCommands commands);

        /// <summary>
        /// Creates a view for a property that has no value.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="commands">The commands available for the view.</param>
        /// <returns>The created view.</returns>
        ViewType CreateUnsetPropertyView(EditProperty property, IEditorCommands commands);
    }
}